<?php

namespace Users\Recover;

class CheckCodeFormConfig extends \Pinenut\Config {
	static $config = [ 
			'htmlOptions' => array (
					'method' => 'POST' 
			),
			'elements' => array (
					'email' => array (
							'type' => 'text',
							'htmlOptions' => array (
									'placeholder' => 'E-mail' 
							),
							'filters' => 'trim',
							'validators' => [ 
									'notEmpty',
									'recordNotExists' => array (
											'className' => '\Pinenut\User\Auth\EmailPassword',
											'where' => [ 
													'type' => 'emailPassword' 
											],
											'whereValue' => 'email' 
									) 
							] 
					),
					'recoveryCode' => array (
							'type' => 'text',
							'htmlOptions' => array (
									'placeholder' => 'Recovery code' 
							),
							'filters' => 'trim',
							'master' => 'email',
							'validators' => [ 
									'notEmpty',
									'checkRecoveryCode' => [ 
											'className' => '\Pinenut\User\Auth\EmailPassword' 
									] 
							],
// 							'slaveElements' => [
// 								'newPassword'
// 							]
					),
					'newPassword' => array (
// 							'master' => 'recoveryCode',
// 							'renderIfValidMaster' => true,
							'type' => 'password',
							'htmlOptions' => array (
									'placeholder' => 'New password' 
							), 
							'validators' => array (
									'notEmpty',
									'length' => array (
											'min' => 6,
											//'max' => 8 
									) 
							) 
					),
					'submit' => array (
							'value' => 'Send',
							'type' => 'submit' 
					) 
			) 
	];
}
